import requests
import json
from method import Log
from config import apis

# DINGTALK_WEBHOOK = apis.DINGTALK_WEBHOOK
DINGTALK_KEYWORD = '交易提醒' # 和你设置的一致

def send_dingding_message(title: str, content: str):
    # headers = {
    #     'Content-Type': 'application/json'
    # }
    # data = {
    #     "msgtype": "markdown",
    #     "markdown": {
    #         "title": title,
    #         "text": f"### {DINGTALK_KEYWORD}：{title}\n\n{content}"
    #     }
    # }
    # response = requests.post(DINGTALK_WEBHOOK, headers=headers, data=json.dumps(data))
    # if response.status_code != 200 or response.json().get('errcode') != 0:
    #     Log.set_log(f"钉钉发送失败: {response.text}", "dingding_errer")
    # else:
    #     print("✅ 钉钉提醒发送成功")
    print("✅ 钉钉提醒发送成功")
    